<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Hello World！</title>
</head>
<body>
    <h1 id="word" style="text-align: center;">Hello World！</h1>

    <button type="button" id="redbutton">变为红色</button>
    <br>
    <button type="button" id="blackbutton">复原</button>

    <script>
        document.getElementById('redbutton').addEventListener('click', trunRed,true)    
        document.getElementById('blackbutton').addEventListener('click',trunDefaultColor ,true)

        function trunRed(){
            document.getElementById("word").style.color='red'
        }

        function trunDefaultColor(){
            document.getElementById("word").style.color='black'
        }
        
    </script>

</body>
</html>